#pragma once

// for any
#include "boost/any.hpp"

using boost::any_cast;

typedef boost::any Any;

#define _TA(x) boost::any(std::string(x))


inline CString& operator<<(CString &ofs,  boost::any a)
{
	int *i = any_cast<int>(&a);
	if(NULL!=i)
		ofs<<*i;
	const char **s = any_cast<const char*>(&a);
	if(NULL!=s)
		ofs<<*s;
	std::string*ss = any_cast<std::string>(&a);
	if(NULL!=ss)
		ofs<<*ss;
	return ofs;
}

// for Stream
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>

typedef boost::iostreams::stream_buffer< boost::iostreams::file_sink> FileStreamBuf;

typedef boost::iostreams::stream< boost::iostreams::file_sink> Stream;

// for Properties
typedef std::map<tstring, boost::any> PropertiesBase;

// for Date & Time

#include "boost/date_time/gregorian/gregorian.hpp"
#include "boost/date_time/posix_time/posix_time.hpp"



/*
template<typename K, typename V> 
class IMap
{
public:
virtual void Add(K key, V value) = 0;
virtual void Remove(K key) = 0;
};

template<typename K, typename V>
class IEnumerator
{
public:
virtual K Key() = 0;
virtual V Value() = 0;

virtual bool MoveNext() = 0;
};

template<typename C>
class StdMapEnumerator : public IEnumerator<C::key_type,C::value_type>
{
public:
virtual K Key() = 0;
virtual V Value() = 0;

virtual bool MoveNext() = 0;
};
*/
class Properties : public PropertiesBase //, public IMap<LPCTSTR, Any>
{
public:
	void Add(LPCTSTR name, Any any)
	{
		insert(value_type(tstring(name), any));
	}

	void Remove(LPCTSTR name)
	{
		erase(name);
	}
};


// misc

#include <boost/format.hpp>
#include <boost/foreach.hpp>
